/* Control.hh -- Faz a interface entre servidor e robôs
 *
 * Copyright (C) 2008, Diogo F. S. Ramos <diogo.ramos@usp.br>
 * GEAR - Grupo de Estudos Avançados em Robótica
 * <http://www.sel.eesc.usp.br/gear>
 *
 * This file is part of GEARMedula.
 * 
 * GEARMedula is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, version 3 of the
 * License.
 * 
 * GEARMedula is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see
 * <http://www.gnu.org/licenses/>.
 */

#ifndef CONTROL_HH_
#define CONTROL_HH_

#include <string>
#include <vector>
#include <pthread.h>

#include "XError.hh"
#include "Serial.hh"
#include "GMSim.hh"

class ControlRobot{
    pthread_mutex_t mutex;
    std::string serial_path_;
    Serial serial_;
public:
    ControlRobot();
    ~ControlRobot();
    void Init( const std::string robot_end, const std::string serial_path );
    void SetVel( const float vx, const float vy, const float va);
    void Kick( const int nivel);
    void DribbleEnable( const int enable);
};
    
class Control{
    int f_real_;
    std::vector<ControlRobot*> box_;
    XError xerror;
    GMSim * sim_;
public:
    Control();
    ~Control();
    void Init( const int f_real, const std::string serial_path);
    void setSim( GMSim * sim );
    void robotSetVel( const int id_robot, const float vx, const float vy, const float va);
    void robotKick( const int id_robot, const int nivel);
    void robotDribbleEnable( const int id_robot, const int enable);
};


#endif	/* CONTROL_HH_ */
